#ifndef __RISCV_CSR_H__
#define __RISCV_CSR_H__

#include <common.h>

static inline int check_csr_idx(int idx) {
  IFDEF(CONFIG_RT_CHECK, assert(idx >= 0 && idx < 4096));
  return idx;
}

#define cgpr(idx) (cpu.cgpr[check_csr_idx(idx)])

#endif
